package com.skivingcloud.report.service.impl;

import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.skivingcloud.report.entity.ReportLuckysheetReportFormsCell;
import com.skivingcloud.report.mapper.ReportLuckysheetReportFormsCellMapper;
import com.skivingcloud.report.service.ReportLuckysheetReportFormsCellService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.skivingcloud.common.utils.PageParameter;

/**
 * 填报报表表格数据和配置信息表 服务层实现。
 *
 * @author skivingcloud
 * @since 2024-11-07
 */
@Service
public class ReportLuckysheetReportFormsCellServiceImpl extends ServiceImpl<ReportLuckysheetReportFormsCellMapper, ReportLuckysheetReportFormsCell> implements ReportLuckysheetReportFormsCellService {

    /**
     * 分页查询填报报表表格数据和配置信息表
     *
     * @param parameter 查询参数
     * @return 分页查询结果
     */
    @Override
    public Page<ReportLuckysheetReportFormsCell> queryByPage(PageParameter<ReportLuckysheetReportFormsCell> parameter){
        Page<ReportLuckysheetReportFormsCell> page = new Page<>(parameter.getPage(), parameter.getPageSize());
        QueryWrapper queryWrapper = QueryWrapper.create();
        if (parameter.getParam() != null) {
            //查询条件
            if (StringUtils.isNoneBlank(parameter.getParam().getId())) {
                queryWrapper.and(ReportLuckysheetReportFormsCell::getId).like(parameter.getParam().getId());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getTplId())) {
                queryWrapper.and(ReportLuckysheetReportFormsCell::getTplId).like(parameter.getParam().getTplId());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getSheetId())) {
                queryWrapper.and(ReportLuckysheetReportFormsCell::getSheetId).like(parameter.getParam().getSheetId());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getDatasetName())) {
                queryWrapper.and(ReportLuckysheetReportFormsCell::getDatasetName).like(parameter.getParam().getDatasetName());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getCellExtend())) {
                queryWrapper.and(ReportLuckysheetReportFormsCell::getCellExtend).like(parameter.getParam().getCellExtend());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getCellValue())) {
                queryWrapper.and(ReportLuckysheetReportFormsCell::getCellValue).like(parameter.getParam().getCellValue());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getCellData())) {
                queryWrapper.and(ReportLuckysheetReportFormsCell::getCellData).like(parameter.getParam().getCellData());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getCellValueType())) {
                queryWrapper.and(ReportLuckysheetReportFormsCell::getCellValueType).like(parameter.getParam().getCellValueType());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getIsMerge())) {
                queryWrapper.and(ReportLuckysheetReportFormsCell::getIsMerge).like(parameter.getParam().getIsMerge());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getCellAttrs())) {
                queryWrapper.and(ReportLuckysheetReportFormsCell::getCellAttrs).like(parameter.getParam().getCellAttrs());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getWarning())) {
                queryWrapper.and(ReportLuckysheetReportFormsCell::getWarning).like(parameter.getParam().getWarning());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getWarningColor())) {
                queryWrapper.and(ReportLuckysheetReportFormsCell::getWarningColor).like(parameter.getParam().getWarningColor());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getThreshold())) {
                queryWrapper.and(ReportLuckysheetReportFormsCell::getThreshold).like(parameter.getParam().getThreshold());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getWarningContent())) {
                queryWrapper.and(ReportLuckysheetReportFormsCell::getWarningContent).like(parameter.getParam().getWarningContent());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getIsFunction())) {
                queryWrapper.and(ReportLuckysheetReportFormsCell::getIsFunction).like(parameter.getParam().getIsFunction());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getCreator())) {
                queryWrapper.and(ReportLuckysheetReportFormsCell::getCreator).like(parameter.getParam().getCreator());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getUpdater())) {
                queryWrapper.and(ReportLuckysheetReportFormsCell::getUpdater).like(parameter.getParam().getUpdater());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getDelFlag())) {
                queryWrapper.and(ReportLuckysheetReportFormsCell::getDelFlag).like(parameter.getParam().getDelFlag());
            }
        }
        return this.page(page, queryWrapper);
    }
}
